{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li><a href="{php echo $this->createWebUrl('manage');}">种植乐园管理</a></li>
		<li><a href="{php echo url('platform/reply/post',array('m'=>'stonefish_planting'));}">添加种植乐园规则</a></li>
		<li class="active"><a href="{php echo $this->createWebUrl('seed');}">种子管理</a></li>
		<li><a href="{php echo $this->createWebUrl('seededit');}">添加种子</a></li>
	</ul> 
    
     <div class="panel panel-info">
	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
        	<input type="hidden" name="m" value="stonefish_planting" />
        	<input type="hidden" name="do" value="seed" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
				<div class="col-xs-12 col-sm-8 col-lg-9">
					<input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
				</div>
                <div class=" col-xs-12 col-sm-2 col-lg-2">
					<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
				</div>
			</div>
 			<div class="form-group">
			</div>
		</form>
	</div>
 
    </div>
    
	<div class="panel panel-default">
		<div class="panel-body table-responsive">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th class='with-checkbox' style="width:50px;">
						<input type="checkbox" class="check_all" />
					</th>
					<th style="width:150px;">种植效果</th>
					<th style="width:150px;">种子名称</th>
					<th style="width:50px;">胚胎值</th>
					<th style="width:50px;">发芽值</th>
					<th style="width:50px;">生长值</th>
					<th style="width:50px;">发枝值</th>
					<th style="width:50px;">繁荣值</th>
					<th style="width:50px;">开花值</th>
					<th style="width:50px;">结果值</th>
					<th style="width:50px;">成熟值</th>
					<th style="width:120px;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $row}
				<tr>
					<td class="with-checkbox">{if $row['uniacid']==$_W['uniacid']}<input type="checkbox" name="check" value="{$row['id']}">{/if}</td>
					<td><img src="{php echo toimage($row['seedimg'])}" width="120px"></td>
					<td>{$row['seedname']}</td>
					<td>{$row['seed01']} </td>
					<td>{$row['seed02']} </td>
					<td>{$row['seed03']} </td>
					<td>{$row['seed04']} </td>
					<td>{$row['seed05']} </td>
					<td>{$row['seed06']} </td>
					<td>{$row['seed07']} </td>
					<td>{$row['seed08']} </td>
					<td>{if $row['uniacid']==$_W['uniacid']}<a class="btn btn-default" data-toggle="tooltip" data-placement="top" href="{php echo url('site/entry/seededit',array('id' => $row['id'], 'm' => 'stonefish_planting'))}" title="编辑种子"><i class="fa fa-edit"></i></a>
					<a class="btn btn-default" data-toggle="tooltip" data-placement="top" href="#" onclick="drop_confirm('您确定要删除吗?', '{php echo $this->createWebUrl('deleteseed',array('id'=>$row['id']))}');" title="删除"><i class="fa fa-times"></i></a>{else}默认不可修改{/if}
                  	</td>
				</tr>
				{/loop}
				<tr>
					<td colspan="12">
						<input type="button" class="btn btn-primary" name="deleteall" value="删除选择的" />
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	</div>
	{$pager}
</div>
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
$(function(){   
    $(".check_all").click(function(){
       var checked = $(this).get(0).checked;
       $("input[type=checkbox]").attr("checked",checked);
    });
	$("input[name=deleteall]").click(function(){
		var check = $("input:checked");
		if(check.length<1){
			alert('请选择要删除的记录!');
			return false;
		}
        if( confirm("确认要删除选择的记录?")){
		var id = new Array();
		check.each(function(i){
			id[i] = $(this).val();
		});
		$.post('{php echo $this->createWebUrl('deleteseedAll')}', {idArr:id},function(data){
			if (data.errno ==0)
			{
				location.reload();
			} else {
				alert(data.error);
			}


		},'json');
		}

	});
});
</script>
<script>
function drop_confirm(msg, url){
    if(confirm(msg)){
        window.location = url;
    }
}
</script>
{template 'common/footer'}